#!/bin/bash
history -w
cp /root/.bash_history /root/.bash_history.$(date "+%Y-%m-%d_%H:%M")
cat /dev/null > /root/.bash_history
history -c
cd /var/log
tar czf /var/log/log.$(date "+%Y-%m-%d_%H:%M").tar.gz {boot.log,btmp,cron,dmesg,firewalld,grubby,lastlog,mail.info,maillog,messages,secure,spooler,syslog,tallylog,wpa_supplicant.log,wtmp,yum.log}
cat /dev/null > /var/log/boot.log
cat /dev/null > /var/log/btmp
cat /dev/null > /var/log/cron
cat /dev/null > /var/log/dmesg
cat /dev/null > /var/log/firewalld
cat /dev/null > /var/log/grubby
cat /dev/null > /var/log/lastlog
cat /dev/null > /var/log/mail.info
cat /dev/null > /var/log/maillog
cat /dev/null > /var/log/messages
cat /dev/null > /var/log/secure
cat /dev/null > /var/log/spooler
cat /dev/null > /var/log/syslog
cat /dev/null > /var/log/tallylog
cat /dev/null > /var/log/wpa_supplicant.log
cat /dev/null > /var/log/wtmp
cat /dev/null > /var/log/yum.log
